<template>
  <el-row :gutter="10" class="dataBoard">
    <el-col :span="6" class="dataBoard-item" v-for="(item, index) in menuList" :key="index">
      <el-card shadow="never">
        <div class="dataBoard-body" style="display: flex; flex-direction: column; padding: 20px 34px 10px">
          <div style="display: flex; flex-direction: row;width: 100%; justify-content: space-between; margin-bottom: 10px">
            <div>
              <span style="color:#b1b0b8; font-size: 20px; display: block; margin-bottom: 5px">{{ item.fullName }}</span>
              <span style="color: #717385; font-weight: bold;font-size: 60px; display: block">{{ item.num }}</span>
            </div>
            <div :style="'background: linear-gradient(to right, ' + color[index].value1 + ', ' + color[index].value2 + '); width: 88px; height: 88px; border-radius: 50%; box-shadow:  0 0 3px ' + color[index].value1 + ', 0 0 5px ' + color[index].value2 + '; display: flex;justify-content: center; align-items: center'">
              <div style="background-color: #fff; width: 55px; height: 55px; border-radius: 50%;  display: flex;justify-content: center; align-items: center">
                <div :style="'background-color: #fff; background: linear-gradient(to right,  ' + color[index].value1 + ', ' + color[index].value2 + '); width: 21px; height: 21px; border-radius: 50%; box-shadow:  0 0 3px ' + color[index].value1 + ', 0 0 5px ' + color[index].value2 + ''"></div>
              </div>
            </div>
          </div>
          <div
            style="border-top: 1px solid #f4f4f4;
    padding-top: 19px;
    width: 100%;
    display: flex;
    justify-content: flex-start;"
          >
            <span style="color:#b1b0b8">{{ item.subTitle }}：</span>
            <span style="color:#9fc8cf;">{{ item.details }}</span>
          </div>
        </div>
      </el-card>
    </el-col>
  </el-row>
</template>
<script>
import { previewDataInterface } from '@/api/systemData/dataInterface'
export default {
  props: {
    cuKey: { type: String, default: '' },
    list: { type: Array, default: () => [] }
  },
  data() {
    return {
      menuList: [],
      color: [{ value1: '#46eeda', value2: '#67e97f' }, { value1: '#fa89a0', value2: '#f3a9ca' }, { value1: '#af86ff', value2: '#8c7bf8' }, { value1: '#f3bd64', value2: '#f4b180' }]
    }
  },
  created() {
    this.getData()
  },
  methods: {
    getData() {
      this.menuList = this.list.map(o => {
        if (o.dataType == 'dynamic') {
          previewDataInterface(o.propsApi).then(res => {
            if (res.data.length > 0) {
              o.num = res.data[0].num
              o.details = res.data[0].details
            }
          })
        }
        return o
      })
    }
  },
  watch: {
    list: {
      handler(val) {
        this.menuList = val
      },
      deep: true
    }
  }
}
</script>
<style lang="scss" scoped>
.dataBoard {
  height: 100%;
  //overflow: hidden;
  //min-width: 1644px;
  overflow: auto;
  .dataBoard-item {
    height: 100%;
  }
  >>> .el-card {
    width: 100%;
    height: 100%;
    .el-card__body {
      padding: 0;
      height: 100%;
    }
  }
  .dataBoard-body {
    padding-left: 30px;
    height: 100%;
    display: flex;
    align-items: center;
    .dataBoard-body-item {
      width: 66px;
      height: 66px;
      border-radius: 50%;
      text-align: center;
      line-height: 66px;
      font-size: 36px;
      flex-shrink: 0;
      &.dataBoard-body-item1 {
        background: #f2ebfb;
        color: #7b1ae1;
      }
      &.dataBoard-body-item2 {
        background: #edf8fe;
        color: #4ab8ff;
      }
      &.dataBoard-body-item3 {
        background: #fff7e4;
        color: #ff8b58;
      }
      &.dataBoard-body-item4 {
        background: #fff2f5;
        color: #fc5b87;
      }
    }
    .text {
      display: inline-block;
      height: 56px;
      .num {
        font-size: 20px;
        line-height: 36px;
      }
      .name {
        font-size: 14px;
        color: #666;
      }
    }
  }
}
</style>
